﻿#ifndef DLGSTART_H
#define DLGSTART_H

#include <QDialog>
#include <QDebug>
#include <QLabel>
#include <QVector>
#include <QBoxLayout>
#include <QQuickWidget>
#include <QtQuick>
#include "websocketserver/websocketserver.h"
#include "netcomm.h"
#include "dlgbottomscreen.h"

class wallinfo{
public:
    QLabel *label;
    QString name;
    /* 随机位置和固定位置：随机位置指上墙位置随机；固定位置指上固定位置固定；
     * 随机位置上墙：名字为空，并且bIsUpWallReady=false，当收到来宾上墙消息时，bIsUpWallReady=true.
     * 固定位置上墙：名字匹配，并且bIsUpWallReady=false，当收到来宾上墙消息时，bIsUpWallReady=true.
     * 定时器挨个取上墙完毕一个,bIsUpWallOver=true
     */
    bool bIsUpWallReady;
    bool bIsUpWallOver;
};

namespace Ui {
class DlgStart;
}

class DlgStart : public QDialog
{
    Q_OBJECT

public:
    explicit DlgStart(QWidget *parent = 0);
    ~DlgStart();

    bool m_bHaveExScreen;
    QTimer m_timerScreen;
    QSqlDatabase m_db;
    QSqlQuery *m_dbquery;
    bool m_bOnebyOnewall;
    bool m_bRobotStartSuc;
    int m_nLoadingCount;
    netComm *m_netcomm;
    bool m_bStartRite;
private:
    QLabel *m_label_back;
    QVBoxLayout *m_layoutglobal;
private:
    void Init();
    void loadLayout();
    void loadUI();
    void UnInit();
    void clearVector();
    QVector<wallinfo*> m_vector;
    websocketserver *m_websocketServer;
    QString m_szLog;
    QString m_masterDir;
    QTimer m_timer;
    QTimer m_signalTimer;
    QTimer m_ttsStateTimer;
    //
    QProcess *m_objNginx;
    bool m_bStartNginx;
    //
    int m_nttsType;
    QString m_endTts;
    QString m_randomtts1;
    QString m_randomtts2;
    QString m_randomtts3;
    QString m_backmusicPath;
    QString m_sucmusicPath;
    QString speakername;
    int speakerSpeed;
    int speakerPicth;
    //
    QQuickWidget *m_quick;
    DlgBottomScreen *m_bottonScreen;
signals:


private slots:
    void slotWallRun(int nType, QString data);

    void slotTimerout();
    void slotLastTimer();
    void sequentialAnimation(int originX, int originY, QLabel *label);
    void parallelAnimation();
    void ctrlActivity(bool bStart);
    void slottsStateTimer();
private:
    Ui::DlgStart *ui;
};

#endif // DLGSTART_H
